package com.zbkj.dal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.dal.entity.profit.ShareProfitRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author JinXinyu
 * @date 2024-02-12 13:58:59
 */
public interface ShareProfitRecordDao extends BaseMapper<ShareProfitRecord> {
    int batchInsert(@Param("shareProfitRecords") List<ShareProfitRecord> shareProfitRecords);

    @Transactional(rollbackFor = Exception.class)
    void updateStatus(@Param("ids") List<Integer> ids, @Param("status") String status);

    @Transactional(rollbackFor = Exception.class)
    @Update("update eb_share_profit_record r set r.share_status = #{status}, r.finished_time = #{finishedTime}, r.update_time = current_timestamp where r.biz_order_no = #{bizOrderNo}")
    void updateStatusByNo(@Param("bizOrderNo") String bizOrderNo, @Param("status") String status, @Param("finishedTime") LocalDateTime finishedTime);
}
